package com.uqbar.asteroids.game;

import java.awt.Color;
import java.awt.Dimension;

import com.uqbar.asteroids.components.Marcador;
import com.uqbar.asteroids.components.Player;
import com.uqbar.asteroids.components.RedBoom;
import com.uqbar.asteroids.endscene.EndScene;
import com.uqbar.asteroids.imageComponents.ShipRender;
import com.uqbar.asteroids.scenes.AsteroidScene;
import com.uqbar.vainilla.DesktopGameLauncher;
import com.uqbar.vainilla.Game;

public class AsteroidsGame extends Game{

	@Override
	protected void initializeResources() {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void setUpScenes() {
		AsteroidScene scene = this.buildAsteroidScene();
		this.setCurrentScene(scene);
	}

	public AsteroidScene buildAsteroidScene() {
		AsteroidScene scene = new AsteroidScene();
//		scene.agregarAsteroides(0);
//		scene.addComponent(new BigAsteroid(this.getDisplayWidth(),this.getDisplayHeight()));
//		scene.addComponent(new MediumAsteriod(this.getDisplayWidth(), this.getDisplayHeight()));
//		scene.addComponent(new TinyAsteroid(getDisplayWidth(), getDisplayHeight()));
		scene.setShipselected(new RedBoom());
		scene.setMarcador(new Marcador(0,0,Color.BLACK));
		scene.addComponent(scene.getMarcador());
		scene.setJugador(new Player(getDisplayWidth(), getDisplayHeight(), scene.getShipselected()));
		scene.setSkinShip(new ShipRender("/ship.png",scene.getShipselected().getX()-60,scene.getShipselected().getY() - 40));
		scene.getShipselected().setX(300);
		scene.getShipselected().setY(300);
		
		scene.agregarAsteroides(5);
		return scene;
	}
	
	public AsteroidScene buildAsteroidSceneWithMarker(Marcador marcador){
		AsteroidScene scene = new AsteroidScene();
		scene.sustituirMarcadorPorMarcador(marcador);
		
//		scene.addComponent(new BigAsteroid(this.getDisplayWidth(),this.getDisplayHeight()));
//		scene.addComponent(new MediumAsteriod(this.getDisplayWidth(), this.getDisplayHeight()));
//		scene.addComponent(new TinyAsteroid(getDisplayWidth(), getDisplayHeight()));
		scene.setShipselected(new RedBoom());
		scene.setJugador(new Player(getDisplayWidth(), getDisplayHeight(), scene.getShipselected()));
		scene.setSkinShip(new ShipRender("/ship.png",scene.getShipselected().getX()-60,scene.getShipselected().getY() - 40));
		scene.getShipselected().setX(300);
		scene.getShipselected().setY(300);
		return scene;
	}

	public EndScene buildEndScene(Marcador marcador){
		return new EndScene(marcador, this.getDisplayWidth() / 6,
				this.getDisplayHeight() / 10);
	}
	
	@Override
	public Dimension getDisplaySize() {
		return new Dimension(800,600);
	}

	@Override
	public String getTitle() {
		return "Asteroids";
	}
	
	public static void main(String[] args) throws Exception {
		new DesktopGameLauncher(new AsteroidsGame()).launch();
	}

}
